{include file="top.html"}
<link rel="stylesheet" href="{$CSS_PATH}order.css"/>
<!--detail Start-->
<div class="wrapper clearfix">
  <div class="container">
    <div class="center">

        {include file="user_left.html"}

        <div class="sidebar_r">
            <div class="box-hd">
                <h1 class="title">身份验证</h1>
            </div>
            <div class="user-box">
             <div class="updatePassword clearfix " id="check-user">
                <h3 class="user-title">账号 ：{$phone}</h3>
                  <div class="hf-input ">
                    <input id="change-check-password" type="password" class="h" name="password" maxlength="20" placeholder="输入登录密码" data-hf-widgets="2">
                    <span class="hf-err-tips" style="display: none;" id="check-password-error"><i class="iconfont icon_error"></i><span>密码格式不正确</span></span>
                  </div>
              
                  <button class="hf-btn btn-bule" type="submit" id="check-user-submit">下一步</button>
                 
                </div>
            <!-- 下一步 -->
                <div class="updatePassword clearfix " id="change-password-next-step" style="display: none">
                  <div class="hf-input ">
                    <input id="new-password-one" type="password" class="h" name="password" maxlength="20" placeholder="设置新密码" data-hf-widgets="2">
                    <span class="hf-err-tips" id="new-password-one-error"><i class="iconfont icon_error"></i><span>密码格式不正确</span></span>
                  </div>
                  <div class="hf-input ">
                    <input id="new-password-two" type="password" class="" name="password" maxlength="20" placeholder="重读新密码" data-hf-widgets="2">
                    <span class="hf-err-tips" id="new-password-two-error"><i class="iconfont icon_error"></i>密码不一致</span>
                  </div>
                  <button class="hf-btn btn-bule" type="submit" id="check-user-submit-confirm">确认修改</button>
                 
                </div>
            </div>
           
        </div>
    </div>
  </div>

</div>
<script>
    $(function(){
        $("#check-user-submit" ).click(function(){
            var password= $.trim($('#change-check-password' ).val());
            $.post('?act=login',{password:password},function(data){
                console.info(data);
                if(data.status=='false'){
                    return $("#check-password-error" ).show().find('span' ).text(data.error);
                }
                $("#check-user" ).hide();
                $("#change-password-next-step" ).show();
            },'json');
        })
        $("#check-user-submit-confirm" ).click(function(){
            var new_password_one= $.trim($("#new-password-one" ).val());
            var new_password_tow= $.trim($("#new-password-two" ).val());
            if(new_password_one.length<6)
            {
                return $("#new-password-one-error" ).show().find('span' ).text('请正确输入密码不小于6位的密码');
            }
            if(new_password_one==''||new_password_one!=new_password_tow)
            {
                return $("#new-password-two-error" ).show().find('span' ).text('两次密码不一致');
            }
            $.post('?act=reset_password',{new_password: new_password_one},function(data){
                if(data.status=='false')
                {
                    return $("#new-password-two-error" ).show().find('span' ).text('修改失败请稍后再试');
                }
                alert('密码修改成功');
                window.location.href="user.php";
            },'json')
        })
    })
</script>
{include file="foot.html"}
</body>
</html>